package common

import (
	"time"

	"gorm.io/gorm"
)

type GVA_MODEL struct {
	ID        uint           `gorm:"primarykey"` // 主键ID
	CreatedAt time.Time      // 创建时间
	UpdatedAt time.Time      // 更新时间
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
}
type ReqModel struct {
	Input    string `json:"input" form:"input" gorm:"column:input;comment:模型输入;type:text;"`
	ReqState int    `json:"reqState" form:"reqState" gorm:"default:0;column:req_state;comment:请求的状态;type:smallint;"`
}
type ReqMessage struct {
	GVA_MODEL
	ReqState  int    `json:"reqState" form:"reqState" gorm:"default:0;column:req_state;comment:请求的状态;type:smallint;"`
	RequestID int    `json:"requestID" form:"requestID" gorm:"column:request_id;comment:服务请求id，对应数据库id"`
	ReqName   string `json:"reqName" form:"reqName" gorm:"column:req_name;comment:请求的名称，对应的路由名称;type:varchar(20);"`
}

// TableName ReqMessage 表名
func (ReqMessage) TableName() string {
	return "req_msg"
}

// FakeDetect 结构体
// 如果含有time.Time 请自行import time包
type FakeDetect struct {
	GVA_MODEL
	ReqModel
	Url           string        `json:"url" form:"url" gorm:"column:url;comment:待检测的链接;type:varchar(50);"`
	PlateForm     int           `json:"plateForm" form:"plateForm" gorm:"column:plate_form;comment:社交平台类型;"`
	FakeDetectRes FakeDetectRes `json:"fakeDetectRes" form:"fakeDetectRes"`
}

// TableName FakeDetect 表名
func (FakeDetect) TableName() string {
	return "fake_detect"
}

type FakeDetectRes struct {
	TagPercent   string `json:"tagPercent" form:"tagPercent" gorm:"column:tag_percent;comment:tag标签三个预测结果各自的比例，以逗号分割;type:varchar(50);"`
	Stance       string `json:"stance" form:"stance" gorm:"column:stance;comment:记录用户立场的json字符串;type:text;"`
	FakeDetectID uint
}

func (FakeDetectRes) TableName() string {
	return "fake_detect_res"
}
